package exam.test19;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: Endstart
 * Date: 2020-12-22
 * Time: 4:45
 */
public class Edge {

    private int label;
    private boolean marked;
    private Node first, second;
    private Edge twin;

    public Edge(Node first, Node second) {
        this.first = first;
        this.second = second;
        label = -1;
        twin = null;
        marked = false;
    }

    public Edge(int label, Node first, Node second) {
        this.label = label;
        this.first = first;
        this.second = second;
        twin = null;
        marked = false;
    }

    public Node firstEndpoint() {
        return first;
    }

    public Node secondEndpoint() {
        return second;
    }

    public void mark() {
        marked = true;
        if (twin != null) {
            twin.marked = true;
        }
    }

    public boolean isMarked() {
        return marked == true;
    }

    public void unmark() {
        marked = false;
    }

    public int getLabel() {
        return label;
    }

    public void setTwin(Edge otherEdge) {
        twin = otherEdge;
    }

    public Edge getTwin() {
        return twin;
    }
}
